(function($) {
  'use strict';

  $(function() {
    var $fullText = $('.admin-fullText');
    $('#admin-fullscreen').on('click', function() {
      $.AMUI.fullscreen.toggle();
    });

    $(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() {
      $fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏');
    });
  });
})(jQuery);
var domain = getRootPath();
var geoc = new BMap.Geocoder();
setInterval(function(e) {
	myAjax(domain + "/api/sos/getonesos.do", {"status":1}, function(data) {
		if (data.code == 200) {
        if(data.result!=0)
        	{
        	var detail=data.detail;
        	
        	$.each(detail,function(i, item) {
      	geoc.getLocation(new BMap.Point(item.longtitude,item.latitude),function(rs) {
            		var addComp = rs.addressComponents;
            		var address = addComp.city
    				+ " "
    				+ addComp.district
    				+ "  "
    				+ addComp.street
    				+ "  "
    				+ addComp.streetNumber;
            		myAlert("警告", "用户"+item.role.realname+"的孩子在地点："+address+"  时间"+item.happendtime+"，发出SOS信号", function(e){
                		
                		myAjax(domain + "/api/sos/changesos.do", {
                			sosiid:item.sosiid
                		}, function(data) {
                    		
                			if(data.code=='200')
                				alert(item.sosiid);
                				myPost(domain + '/sosdetail.jsp', {
                					'sosiid' : item.sosiid
                				});
                    		
                    	});		
            		
            	});
            
            	});
        		
        	});
        
        	
        	
        	}
		}
	})
}, 120000);